#ifndef MYOPENBTN_H
#define MYOPENBTN_H

#include<QPushButton>

QT_BEGIN_NAMESPACE
namespace Ui { class Myprecent; }
QT_END_NAMESPACE

class MyOpenButton : public QPushButton
{
    Q_OBJECT
public:
    MyOpenButton(int width, int height, QWidget *parent = nullptr);
    ~MyOpenButton();
    bool isChecked() const;
    void setChecked(bool checked);

signals:
    void toggled(bool checked);

protected:
    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
private:
    bool m_checked;
    QRectF m_thumbRect;
    QRectF m_thumbRectOpen;
    int    m_width;
    int    m_height;
};
#endif
